import { http } from '@/common/service/service.js' 
import configService from '@/common/service/config.service.js';
const apiService = {
	 
	 /**
	  * 登录
	  */
	login(params) {
		return http.post('/sys/mLogin',params)	
	},
	/**
	  * 手机号码登录
	  */
	phoneNoLogin(params) {
		return http.post('/sys/phoneLogin',params);
	},
	/**
	  * 第三方登录
	  */
	thirdLogin(token, thirdType,tenantId) {
		return http.get(`/sys/thirdLogin/getLoginUser/${token}/${thirdType}/${tenantId}`);
	},
	/**
	  * 退出
	  */
	logout(params) {
		return http.post('/sys/logout',params);
	},
	/**
	 * 获取文件访问路径
	 * @param avatar
	 * @param subStr
	 * @returns {*}
	 */
	getFileAccessHttpUrl(avatar,subStr){
	    if(!subStr) subStr = 'http'
	    if(avatar && avatar.startsWith(subStr)){
	        return avatar;
	    }else{
	        return configService.staticDomainURL + "/" + avatar;
	    }
	},
	/**
	  * 初始化字典数据
	  */
	initDictData(params) {
		return http.get(`/sys/dict/getDictItems/${params}`);
	},
	
	/**
	  * 图片上传
	  */
	uploadFiles(params) {
		console.log("---params----"+JSON.stringify(params))
		return http.upload(`/sys/common/upload`,params);
	},
	
	/**
	  * 保存隐患
	  */
	addBaseDangerInvestigation(params) {
		return http.post('/TbBaseDangerInvestigation/tbBaseDangerInvestigation/add',params);
	},
	/**
	  * 获取电子作业票编号
	  */
	queryJobCode() {
		return http.get(`/TbJobTicket/tbJobTicket/queryJobCode`);
	},
	/**
	  * 保存电子作业票信息
	  */
	saveGenerateTickets(params) {
		return http.post('/TbJobTicket/tbJobTicket/generateTicketsApp',params);
	},
	/**
	  * 获取电子作业票列表
	  */
	queryJobTicketList(params) {
		return http.get(`/TbJobTicket/tbJobTicket/list`,{params:params});
	},
	
	/**
	  * 获取电子作业票JSA分析
	  */
	queryJSAAnalysisList(params) {
		return http.get(`/TbJobTicket/tbJobTicket/listTbJobTicketJsaAnalyzeByMainId`,{params:params});
	},
	
	/**
	  * 获取电子作业票管控措施分析
	  */
	queryMeasureRecordList(params) {
		return http.get(`/TbJobTicket/tbJobTicket/listTbJobTicketMeasureRecordByMainId`,{params:params});
	},
	
	/**
	  * 获取电子作业票安全交底
	  */
	querySecurityDisclosureRecordList(params) {
		return http.get(`TbJobTicket/tbJobTicket/listTbJobTicketSecurityDisclosureRecordByMainId`,{params:params});
	},
	
	/**
	  * 获取电子作业票票证签发
	  */
	queryJobTicketExamineRecordList(params) {
		return http.get(`/TbJobTicket/tbJobTicket/listTbJobTicketExamineRecordByMainId`,{params:params});
	},
	
	/**
	  * 获取电子作业票过程信息
	  */
	queryJobTicketCourseRecordList(params) {
		return http.get(`/TbJobTicket/tbJobTicket/listTbJobTicketCourseRecordByMainId`,{params:params});
	},
};

export default apiService;
